package com.leyou.item.mapper;

import com.leyou.item.entity.Brand;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.additional.idlist.IdListMapper;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;


public interface BrandMapper extends Mapper<Brand>, IdListMapper<Brand,Long> {
    int insertBrandCategory(@Param("id") Long brandId, @Param("cids") List<Long> cids);

    @Select("SELECT b.* FROM tb_brand b INNER JOIN tb_category_brand cb ON b.`id` = cb.`brand_id` WHERE cb.`category_id` = #{cid}")
    List<Brand> queryBrandByCid(@Param(value = "cid") Long cid);
}
